import  json
import urllib.request

import jsonpath

# 没写个啥，自己学习解析JSON数据

url = 'https://dianying.taobao.com/cityAction.json?city=&_ksTS=1663667767890_19&jsoncallback=jsonp20&action=cityAction&n_s=new&event_submit_doLocate=true'


headers = {
# ':authority':' dianying.taobao.com',
# ':method':' GET',
# ':path':' /cityAction.json?city=&_ksTS=1663667767890_19&jsoncallback=jsonp20&action=cityAction&n_s=new&event_submit_doLocate=true',
# ':scheme':' https',
'accept':'text/javascript, application/javascript, application/ecmascript, application/x-ecmascript, */*; q=0.01',
# 'accept-encoding':' gzip, deflate, br',
'accept-language':'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
'cookie':'t=5651b91fcc7a5e8591020bb94b74c65d; cookie2=126849ff69ec6a08f7e1e4632c5c294b; v=0; _tb_token_=5ebe1e6ee3b88; cna=8+LAGK3/qW4CATz/TXxu2nuW; _samesite_flag_=true; xlly_s=1; isg=BAsLXRX77PsH0zFaekJorGCamq_1oB8inVu9XX0JicqhnCr-BXDDcuV9dpxyvHca; l=eBIAAP1PLVxPyeJpBO5ahurza77OfIOb8sPzaNbMiInca6sRtFaD3NCEfgbwSdtjgt1jJetz5TzfvdBcl3jR2xDDB7kqm0zrnxf..; tfstk=cUHNBPMUYdpwFRDffJyqLiFAucNOaaU0P9rzsUUjv6XhdZV3zsbFkkxN1krVYZVG.',
'referer': 'https://dianying.taobao.com/',
'sec-ch-ua':'"Google Chrome";v="105", "Not)A;Brand";v="8", "Chromium";v="105"',
'sec-ch-ua-mobile':'?0',
'sec-ch-ua-platform':'"Windows"',
'sec-fetch-dest':'empty',
'sec-fetch-mode':'cors',
'sec-fetch-site':'same-origin',
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36',
'x-requested-with':'XMLHttpRequest'
}

request = urllib.request.Request(url=url, headers=headers)
proxies = {
        'http': '120.194.55.139:6969'
    }
handler = urllib.request.ProxyHandler(proxies=proxies)
opener = urllib.request.build_opener(handler)
response = opener.open(request)

# response = urllib.request.urlopen(request)

content = response.read().decode('utf-8')
print(content)
